package com.corpgovernment.organization.enumm;

import java.util.Arrays;

public enum PassportEnum {

    P("P", "因私"),
    I("I", "因公"),
    D("D", "外交");

    private String code;
    private String desc;

    PassportEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static PassportEnum getByCode(String code) {
        return Arrays.stream(PassportEnum.values()).filter(e -> code.equals(e.code)).findFirst().orElse(null);
    }
}
